
package NWPackage;

import java.util.HashMap;
import java.util.List;
import java.util.Set;



public class OneSettingDistMatrix {
	private AgentsDistMatrix matrix;
	
	public OneSettingDistMatrix()
	{
		this.matrix = new AgentsDistMatrix();
	}
	
	public void importProbabilitiesMatrix(ProbabilitiesMatrix probMatrix)
	{
		String[] agentsNames = probMatrix.getAgentsNames();
		
		for (String agent : agentsNames) {
			this.matrix.addAgentProbs(agent,probMatrix.getAgentProbs(agent));
		}
	}
	
	public double getVoteProb(String agentName, String candidate, int vote)
	{
		return this.matrix.getVoteProb(agentName, candidate,vote);
	}

	public void initialVoter(String agentName, String[] candidates, int numOfVotes) {
		this.matrix.addEmptyAgent(agentName,candidates,numOfVotes);
		
	}

	public int getNumberOfVotes(String agent, String candidate) {
		return this.matrix.getNumberOfVotes(agent,candidate);
	}

	public void fixRank(String agent, String candidate, int i) {
		//palce 1 where Rank = i and 0 elsewhere
		this.matrix.fixRank(agent,candidate,i);
		
	}

	public Set<String> getVoters() {
		return this.matrix.getVoters();
	}


	public void addVotesToAgent(String agentName, String candidate,	List<String> votes) {
		matrix.addVotesToAgent(agentName, candidate, votes);
	}

	public List<String> getCandidatesList() {
		return this.matrix.getCandidatesList();
	}

	public HashMap<String, RankDist> getProbsForAgentAndCandidate(String agent,String candidate) {
		return this.matrix.getAgentAndCandidatesVotes(agent,candidate);
	}

	//this will use us in the Dynamic Probabilities Algorithm
	public void SetAgentProbsFromOther(String agent,HashMap<String, RankDist> allProbsIsWinner) {
		matrix.SetAgentProbsFromOther(agent,allProbsIsWinner);
		
	}

	public double getSumOfVotes(String agent, String cand) {
		return matrix.getSumOfVotes(agent,cand);
	}
	
	public OneSettingDistMatrix clone() {
		OneSettingDistMatrix newMatrix = new OneSettingDistMatrix();
		newMatrix.matrix = this.matrix.clone();
		return newMatrix;
	}

}
